﻿@model List<ForumCategory>
@{
    ViewBag.Title = T("Forums");
}
@if (!ViewData.GetDefault<bool>("ShowFirstSteps"))
{
    <div class="forumList">
        <h1>@ViewBag.Title</h1>
        <div class="options">
            <a rel="nofollow" href="@Url.Action("LatestAllTopics")">@Html.Img("~/images/iconrss.gif", "rss")</a>
        </div>
        <div>
        <ul class="ind_plateNav">
         @foreach (ForumCategory category in Model)
         { 
             <li><a href="#@category.Id">@category.Name</a></li>
         }
         </ul>
        </div>
        @foreach (ForumCategory category in Model)
        {
            <p class="border-t"></p>
            <a class="category-a" name=@category.Id>@category.Name</a>
            <ul class="itemsHeader">
                <li class="name">@T("Forum")</li>
                <li class="topicCount">@T("Topics")</li>
                <li class="replies">@T("Posts")</li>
            </ul>
            
            string tableID = "category_" + @category.Id;
            string imgID = "category_" + @category.Id+"_img";
            <span class="headactions">
                <img id=@imgID src=@Url.Content("~/images/Common/collapsed_no.gif") title="收起/展开" alt="收起/展开" onclick="toggle_collapse('@tableID');">
            </span>
            <table id=@tableID class="list">
                <tbody>
                    @foreach (Forum forum in category.Forums)
                    {

                        <tr>
                            <th>
                                <a href=@Url.Action("Detail", new { forum = forum.ShortName })>
                                    @if (forum.ForumIcon == null)
                                    {
                                        <img class="iconImg" src=@Url.Content("~/images/Forums/empty.jpg") alt=@forum.Id />
                                    }
                                    else
                                    {
                                        <img class="iconImg" src=@Url.Content(forum.ForumIcon) alt=@forum.Id />
                                    }
                                </a>
                                <div class="left">
                                    <h3 class="name" style="color: #10542b">
                                        @Html.ActionLink(forum.Name, "Detail", new { forum = forum.ShortName })
                                    </h3>
                                    <p>@forum.Description</p>
                                    <p style="color:#636363; font-size:12px">
                                        @forum.TopicCount <span class="label">@(forum.TopicCount != 1 ? T("threads") : T("thread"))</span>
                                        <span class="separator">/ </span>
                                        @forum.MessageCount <span class="label">@(forum.MessageCount != 1 ? T("posts") : T("post"))</span>
                                    </p>
                                </div>
                            </th>
                        </tr>
                    }
                </tbody>
            </table>
        }
        @if (Model.Count == 0)
        {
            <p>
                @T("No forums found.")
                <br />
                @Html.ActionLinkLocalized("Create a forum", "Add")
            </p>
        }
    </div>
}
else
{
    <div class="first-steps">
        <h1>@T("Welcome to Nearforums!")</h1>
        <p>
            <strong>@T("You've successfully setup your Nearforums site")</strong></p>
        <p>
            <a href="http://www.nearforums.com/admin-first-steps" target="_blank">@T("Here are a few things you can do to get started")</a>.</p>
    </div>
}
